package com.lbs.jiepiaisi.fragment;

import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;

import com.lbs.jiepiaisi.R;
import com.lbs.jiepiaisi.base.BaseFragment;

/**
 *
 * 时间：2017/6/16 10:14
 * 作用：平台登录入口
 */

public class PlatformFragment extends BaseFragment {

    private Button vinLoginBtn;//车架号登录
    private Button accountLoginBtn;//账号登录

    @Override
    public View initView(LayoutInflater inflater) {
        View view = inflater.inflate(R.layout.fragment_platform,null);
        return view;
    }

    @Override
    protected void getExtras(View view) {

    }

    @Override
    protected void findView(View view) {
        vinLoginBtn = (Button) view.findViewById(R.id.btn_vinlogin);
        accountLoginBtn = (Button) view.findViewById(R.id.btn_accountlogin);
        FragmentTransaction fragment = getFragmentManager().beginTransaction();
        fragment.replace(R.id.fragment_container_platform, new AccountLoginFragment());
        fragment.commit();
        vinLoginBtn.setSelected(false);
        accountLoginBtn.setSelected(true);
        accountLoginBtn.setTextSize(23);
        vinLoginBtn.setTextSize(16);
    }

    @Override
    protected void setListener(View view) {
        //车架号登录
        vinLoginBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FragmentTransaction fragment = getFragmentManager().beginTransaction();
                fragment.replace(R.id.fragment_container_platform, new VinLoginFragment());
                fragment.commit();
                vinLoginBtn.setSelected(true);
                accountLoginBtn.setSelected(false);
                vinLoginBtn.setTextSize(23);
                accountLoginBtn.setTextSize(16);
            }
        });
        //账号登录
        accountLoginBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                FragmentTransaction fargment = getFragmentManager().beginTransaction();
                fargment.replace(R.id.fragment_container_platform, new AccountLoginFragment());
                fargment.commit();
                vinLoginBtn.setSelected(false);
                accountLoginBtn.setSelected(true);
                accountLoginBtn.setTextSize(23);
                vinLoginBtn.setTextSize(16);
            }
        });
    }
}
